home *** CD-ROM | disk | FTP | other *** search
/ Multimedia Dogs / Multimedia Dogs v2.0.iso / mac / Extras / MMDogs 2.0 with Desktop / MMDOGS2.DXR / 00275_Sound handlers.ls < prev    next >
Encoding:
Text File  |  1995-10-09  |  856 b   |  31 lines

  1. global gpRandomSoundList, gpRandomSoundCount
  2.  
  3. on initRandomSounds theSoundList
  4.   set gpRandomSoundList to theSoundList
  5.   set gpRandomSoundCount to count(theSoundList)
  6.   set the timeoutMouse to 1
  7.   set the timeoutKeyDown to 1
  8. end
  9.  
  10. on enableRandomSounds
  11.   set the timeoutLength to (random(20) + 60) * 60
  12.   set the timeoutScript to "playRandomSound"
  13.   putDebug("enableRandomSounds" && the timeoutLength / 60)
  14. end
  15.  
  16. on disableRandomSounds
  17.   set the timeoutScript to EMPTY
  18.   putDebug("disableRandomSounds")
  19. end
  20.  
  21. on playRandomSound
  22.   set theRandomSoundIndex to random(gpRandomSoundCount)
  23.   set theSoundName to getAt(gpRandomSoundList, theRandomSoundIndex)
  24.   if (soundBusy(1) = 0) and (soundBusy(2) = 0) then
  25.     puppetSound(theSoundName)
  26.     putDebug("playRandomSound" && theSoundName && theRandomSoundIndex)
  27.     updateStage()
  28.   end if
  29.   enableRandomSounds()
  30. end
  31.